package com.teambsc4.todo.views

import android.Manifest
import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.location.LocationManager
import android.net.Uri
import android.os.Bundle
import android.provider.MediaStore
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContract
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.app.ActivityCompat
import com.teambsc4.todo.App
import com.teambsc4.todo.model.MyDatabase
import com.teambsc4.todo.model.TaskItemDao
import com.teambsc4.todo.ui.theme.TodoTheme
import com.teambsc4.todo.viewmodel.MainPageViewModel
import com.teambsc4.todo.views.CreateTaskButton
import com.teambsc4.todo.views.TodoListBox


class MainActivity : ComponentActivity() {

    private val viewModel = MainPageViewModel()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContent {
            TodoTheme {
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    TodoListBox(viewModel)
                    CreateTaskButton(viewModel)
                }
            }
        }
    }


}